package lazy.tool;

public class JdbcUrlUtils {
	public static String getJdbcUrl(DBType dbType, String address, String port, String schema) {
		String url = null;
		switch (dbType) {
			case MySQL:
				url = new StringBuilder("jdbc:mysql://").append(address).append(":").append(port).append("/").append(schema).toString();
				break;
			case MSSQLServer:
				url = new StringBuilder("jdbc:jtds:sqlserver://").append(address).append(":").append(port).append("/").append(schema).toString();
				break;
		}
		return url;
	}
	public static String getJdbcUrl(DBType dbType, String address, String schema) {
		String port = null;
		switch (dbType) {
			case MySQL:
				port = "3306";
				break;
			case MSSQLServer:
				port = "1433";
				break;
		}
		return getJdbcUrl(dbType, address, port, schema);
	}
}
